package com.learn.thread;

/**
 * 设置线程优先级
 */
public class TestThreadPriority implements Runnable{
    @Override
    public void run() {

        System.out.println(Thread.currentThread().getName()+"：.....start,其优先级："+Thread.currentThread().getPriority());
    }

    public static void main(String[] args) {
        TestThreadPriority t1 = new TestThreadPriority();
        Thread thread1 = new Thread(t1, "t1");
        Thread thread2= new Thread(t1, "t2");
        Thread thread3= new Thread(t1, "t3");
        thread2.setPriority(Thread.MAX_PRIORITY);
        thread3.setPriority(Thread.NORM_PRIORITY);
        thread1.setPriority(Thread.MIN_PRIORITY);
        thread1.start();
        thread2.start();
        thread3.start();

    }
}
